import React, {Component} from 'react';
import render from 'src/hrpub/common/frame/render';
import {connect} from 'src/hrpub/common/store';
import cardAction from '../../actions/cardAction';
import './index.less'
import {
    base
} from 'nc-lightapp-front';

const {
    NCButton
} = base;
const CardDetail = render({
    actions: {
        cardAction
    }
})(({props, action, state}) => {
    const {myLeave, form, formCode, editTable} = props
    const {cardAction} = action
    const {createForm} = form
    const {json = {}} = myLeave;
    let display = myLeave.showMode === 'card' && myLeave.activeTab + '_card' === formCode
    return (
        <div className="apply-card-detail"
             style={{display: display ? '' : 'none', height: myLeave.clientHeight + 128 + 'px', background: '#FFF'}}>
            <div>
                {createForm(formCode, {
                    onAfterEvent: cardAction.onAfterEvent,
                    setVisibleByForm: true
                })}
            </div>
        </div>
    );
})


export default connect(CardDetail);